home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / libsane-extras.preinst < prev    next >
Encoding:
Text File  |  2010-05-03  |  2.0 KB  |  56 lines

  1. #!/bin/sh
  2. set -e
  3.  
  4. # From http://wiki.debian.org/DpkgConffileHandling
  5. # Remove a no-longer used conffile
  6. rm_conffile() {
  7.     PKGNAME="$1"
  8.     CONFFILE="$2"
  9.     if [ -e "$CONFFILE" ]; then
  10.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  11.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
  12.         if [ "$md5sum" != "$old_md5sum" ]; then
  13.             echo "Obsolete conffile $CONFFILE has been modified by you."
  14.             echo "Saving as $CONFFILE.dpkg-bak ..."
  15.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  16.         else
  17.             echo "Removing obsolete conffile $CONFFILE ..."
  18.             rm -f "$CONFFILE"
  19.         fi
  20.     fi
  21. }
  22.  
  23. ## Transition from the old-style udev setup to the old-style dh_installudev setup
  24. ## Then dh_installudev will take care of the transition to the new dh_installudev setup
  25. if [ "$1" = install ] || [ "$1" = upgrade ]; then
  26.     if [ -e "/etc/udev/rules.d/025_libsane-extras.rules" ]; then
  27.     mv /etc/udev/rules.d/025_libsane-extras.rules /etc/udev/rules.d/z60_libsane-extras.rules
  28.     fi
  29.  
  30.     ## Remove obsolete /etc/sane.d/epkowa.conf conffile
  31.     if dpkg --compare-versions "$2" le "1.0.19.14"; then
  32.     ## iscan not installed
  33.     if ! dpkg-query -W -f '${Status}\n' iscan > /dev/null 2>&1; then
  34.         rm_conffile libsane-extras /etc/sane.d/epkowa.conf
  35.     fi
  36.     fi
  37.  
  38.     ## Remove obsolete /etc/sane.d/hp_rts88xx.conf
  39.     if dpkg --compare-versions "$2" le "1.0.19.16"; then
  40.     rm_conffile libsane-extras /etc/sane.d/hp_rts88xx.conf
  41.     fi
  42. fi
  43.  
  44. # Automatically added by dh_installudev
  45. if [ "$1" = install ] || [ "$1" = upgrade ]; then
  46.     if [ -e "/etc/udev/rules.d/z60_libsane-extras.rules" ]; then
  47.         if [ "`md5sum \"/etc/udev/rules.d/z60_libsane-extras.rules\" | sed -e \"s/ .*//\"`" = \
  48.              "`dpkg-query -W -f='${Conffiles}' libsane-extras | sed -n -e \"\\\\' /etc/udev/rules.d/z60_libsane-extras.rules '{s/ obsolete$//;s/.* //p}\"`" ]
  49.         then
  50.             rm -f "/etc/udev/rules.d/z60_libsane-extras.rules"
  51.         fi
  52.     fi
  53. fi
  54. # End automatically added section
  55.  
  56.